<?php
class LVAction extends Action{

	//模块使用的模型
	var $model = null;

	//列表信息使用模板
	var $list_template = "ConsultingReview/new_notice";

	//列表信息展示顺序
	var $list_order = "id desc";

	//显示文章使用模板
	var $view_template = "Public/details";

	//要赋值给模板的变量
	var $template_values = array();

	var $module_name = null;
	
	public function __construct(){
		parent::__construct();
		foreach($this->template_values as $value){
			$this->assign($value,true);
		}
		if(!empty($module_name)){
			$this->assign('module_name',$this->module_name);
		}
	}

	//列表显示信息
	public function listall(){
		$this->model = M($this->model);
		import("ORG.Util.Page");
		$count = $this->model->where("state=1")->count();
		$Page = new Page($count,10);
		$show = $Page->show();
		$list = $this->model->where("state=1")->limit($Page->firstRow.','.$Page->listRows)->order($this->list_order)->select();
		$this->assign("module_name",$this->module_name);
		$this->assign("list",$list);
		$this->assign("show",$show);
		$this->display($this->list_template);
	}

	//显示特定一篇文章
	public function view(){
		if(!empty($_GET['id'])){
			$this->model = M($this->model);
			$vo = $this->model->GetById($_GET['id']);
			if($vo){
				$this->assign("vo",$vo);
				$this->display($this->view_template);
			}else{
				$this->error("查看项不存在");
			}
		}else{
			$this->error("非法操作");
		}
	}

}
?>
